package fractal;

public class Terrain
{
  protected double _Hauteur;
  protected double _Temperature;
  protected double _Humidite;
  protected double _Water;
  protected boolean _Forest;
  protected boolean _City;

  protected int _Empire;
  protected double _IndiceEmpire;

  public Terrain()
  {
    _Empire = -1;
    _IndiceEmpire = 0;
    _Water = 0;
  }

  public int getEmpire()
  {
    return _Empire;
  }

  public void setEmpire(int pEmpire)
  {
    this._Empire = pEmpire;
  }

  public double getIndiceEmpire()
  {
    return _IndiceEmpire;
  }

  public void setIndiceEmpire(double pIndiceEmpire)
  {
    this._IndiceEmpire = pIndiceEmpire;
  }

  public boolean isCity()
  {
    return _City;
  }

  public void setCity(boolean pCity)
  {
    this._City = pCity;
  }

  public double getWater()
  {
    return _Water;
  }

  public void setWater(double pWater)
  {
    this._Water = pWater;
  }

  public boolean getForest()
  {
    return _Forest;
  }

  public void setForest(boolean pForest)
  {
    this._Forest = pForest;
  }

  public double getHauteur()
  {
    return _Hauteur;
  }

  public void setHauteur(double pHauteur)
  {
    _Hauteur = pHauteur;
  }

  public double getTemperature()
  {
    return _Temperature;
  }

  public void setTemperature(double pTemperature)
  {
    _Temperature = pTemperature;
  }
  
  public double getHumidite()
  {
    return _Humidite;
  }

  public void setHumidite(double pHumidite)
  {
	  _Humidite = pHumidite;
  }

  public TerrainType getTerrainType()
  {
    if (isCity())
    {
      return TerrainType.CITY;
    }
    if (getHauteur() > 90)
    {
      return TerrainType.MOUNTAIN;
    }
    if (getHauteur() < 60)
    {
      return TerrainType.WATER;
    }
    if (getTemperature() < 10)
    {
      return TerrainType.SNOW;
    }
    if (getTemperature() > 90)
    {
      return TerrainType.DESERT;
    }
    if (getForest())
    {
      return TerrainType.FOREST;
    }

    return TerrainType.PLAT;
  }

}
